<template>
	<view class="content">
		<tabnav :left_icon="true"  :title="list.legal_name+'业绩'" titlcolor="#fff" col="#1262DB"></tabnav>
		<view class="mar-top30 wid90 mar borRad20 box dis disJuC disAl foSi25" style="padding: 40rpx 0;color: #AEACAC;">
			<view style="width: 45%;border-right: 1rpx solid #D3D3D3;">
				<view class="foSi40" style="color: #000;">{{list.legal_name}}</view>
				<view class="mar-top20">加入时间：{{list.createtime}}</view>
				<view class="mar-top20 dis disAl">
					<image src="../../static/myGroup/shouji.png" style="width: 21rpx;height: 33rpx;"></image>
					<view class="mar-left10">{{list.mobile}}</view>
				</view>
				<view class="mar-top20 dis disAl">
					<image src="../../static/myGroup/weizhi.png" style="width: 24rpx;height: 32rpx;"></image>
					<view class="mar-left10">{{list.province_text+'-'+list.city_text+'-'+list.area_text}}</view>
				</view>
			</view>
			<view class="dis disAl disJuC fleDir" style="width: 45%;">
				<view class="foSi35" style="color: #000;">全部机构 <span class="mar-left10" style="color: #1262DB;">{{list.all_clinic}}</span></view>
				<view class="foSi35 mar-top30" style="color: #000;">新增机构 <span class="mar-left10" style="color: #1262DB;">0</span></view>
				<view class="mar-top30">加入时间：{{list.createtime}}</view>
			</view>
		</view>
		<view class="wid90 mar dis disAl mar-top30">
			<view :style="zhanshi == 0?'background-color: #1262DB;color: #fff;':'border: 1rpx solid #ADABAB;color: #ADABAB;'" 
				@click="dangqian()" class="hei60 dis disAl disJuC borRad40 shebei mar-left20">实时</view>
			<view :style="zhanshi == 1?'background-color: #1262DB;color: #fff;':'border: 1rpx solid #ADABAB;color: #ADABAB;'" 
				@click="zuotian()" class="hei60 dis disAl disJuC borRad40 shebei mar-left20">昨日</view>
			<view :style="zhanshi == 2?'background-color: #1262DB;color: #fff;':'border: 1rpx solid #ADABAB;color: #ADABAB;'" 
				@click="qitian()" class="hei60 dis disAl disJuC borRad40 shebei mar-left20">近七日</view>
		</view>
		<view style="height: 50rpx;"></view>
		<view class="dis disAl disJuB wid90 mar" style="color: #AEACAC;">
			<view>时间筛选：</view>
			<view class="bacFFF borRad20 box" style="width: 70%;">
				<uni-datetime-picker v-model="datetimerange" type="daterange" rangeSeparator="至" @change="changeTime" />
			</view>
		</view>
		<view style="height: 50rpx;"></view>
		<view class="box wid90 mar borRad20" style="height: 270rpx;">
			<view class="wid90 mar hei80 dis disAl foSi35" style="border-bottom: 1rpx solid #D3D3D3;font-weight: 600;">
				<view style="height: 40rpx;width: 6rpx;background-color: #1262DB;"></view>
				<view class="mar-left20" style="display: flex;justify-content: space-between;align-items: center;width: 100%;">
					<view class="">
						检测数据
					</view>
					<view class="" style="font-size: 14px;font-weight: 100;color: #000;" @click="go_orderlist()">
						订单列表>
					</view>
				</view>
			</view>
			<view class="mar-top30 wid90 mar dis disAl">
				<view class="mar-left30" style="width: 48%;">
					<view class="foSi25">检测订单</view>
					<view class="mar-top20 foSi40">{{list.order_num}}</view>
				</view>
				<view style="width: 48%;">
					<view class="foSi25">检测金额（元）</view>
					<view class="mar-top20 foSi40">{{list.order_money}}</view>
				</view>
			</view>
		</view>
		<view style="height: 50rpx;"></view>
		<view class="box wid90 mar borRad20" style="height: 270rpx;">
			<view class="wid90 mar hei80 dis disAl foSi35" style="border-bottom: 1rpx solid #D3D3D3;font-weight: 600;">
				<view style="height: 40rpx;width: 6rpx;background-color: #1262DB;"></view>
				<view class="mar-left20" style="display: flex;justify-content: space-between;align-items: center;width: 100%;">
					<view class="">
						机构数据
					</view>
					<view class="" style="font-size: 14px;font-weight: 100;color: #000;" @click="backs">
						机构列表>
					</view>
				</view>
			</view>
			<view class="mar-top30 wid90 mar dis disAl">
				<view class="mar-left30" style="width: 48%;">
					<view class="foSi25">活跃机构</view>
					<view class="mar-top20 foSi40">{{list.hy_clinic}}</view>
				</view>
				<view style="width: 48%;">
					<view class="foSi25">日均活跃率</view>
					<view class="mar-top20 foSi40">{{list.hy_clinic_b}}%</view>
				</view>
			</view>
		</view>
		<!-- <view style="height: 50rpx;"></view>
		<view class="box wid90 mar borRad20" style="height: 420rpx;">
			<view class="wid90 mar hei80 dis disAl foSi35" style="border-bottom: 1rpx solid #D3D3D3;font-weight: 600;">
				<view style="height: 40rpx;width: 6rpx;background-color: #1262DB;"></view>
				<view class="mar-left20">设备数据</view>
			</view>
			<view class="wid90 mar dis disAl mar-top30">
				<view :style="shebei == 0?'background-color: #1262DB;color: #fff;':'border: 1rpx solid #ADABAB;color: #ADABAB;'" 
					@click="dangqian()" class="hei60 dis disAl disJuC borRad40 shebei">血常规</view>
				<view :style="shebei == 1?'background-color: #1262DB;color: #fff;':'border: 1rpx solid #ADABAB;color: #ADABAB;'" 
					class="dis disAl disJuC borRad40 shebei mar-left20">免疫分析仪</view>
			</view>
			<view class="mar-top20 wid90 mar dis disAl">
				<view class="mar-left30" style="width: 48%;">
					<view class="foSi25">绑定设备数</view>
					<view class="mar-top10 foSi40">0</view>
				</view>
				<view style="width: 48%;">
					<view class="foSi25">新增设备数</view>
					<view class="mar-top10 foSi40">0</view>
				</view>
			</view>
			<view class="mar-top20 wid90 mar dis disAl">
				<view class="mar-left30" style="width: 48%;">
					<view class="foSi25">活跃设备数</view>
					<view class="mar-top10 foSi40">0</view>
				</view>
				<view style="width: 48%;">
					<view class="foSi25">日均活跃率</view>
					<view class="mar-top10 foSi40">0%</view>
				</view>
			</view>
		</view> -->
		<view style="height: 100rpx;"></view>
	</view>
</template>

<script>
	import tabnav from "../common/tabnav/tabnav.vue"
	export default {
		components: {
			tabnav,
		},
		data() {
			return {
				// 状态栏高度
				statusBarHeight: 0,
				// 导航栏高度
				navBarHeight: 82+11,
				tele: '',
				uid: '',
				zhanshi: 0,
				datetimerange: [],
				shebei: 0,
				list: ''
			}
		},
		onLoad(options) {
			this.uid = options.uid
			this.dangqian()
		},
		methods: {
			backs(){
				let that = this
				uni.navigateTo({
					url:'/pages/myGroup/jigoulist?uid='+that.uid
				})
				// 新的机构列表
			},
			go_orderlist(){
				uni.navigateTo({
					url:'/pages/myGroup/ywyorderlist?uid='+this.uid
				})
			},
			changeTime(e) {
				this.zhanshi = -1
				this.datetimerange = e;
				if(e.length != 0){
					this.page = 0
					this.performance()
				}
			},
			dangqian(){
				this.zhanshi = 0
				var date = new Date()
				var year = date.getFullYear()
				var month = date.getMonth() + 1
				var day = date.getDate()
				this.datetimerange = [year+'-'+month+'-'+day,year+'-'+month+'-'+day]
				this.performance()
			},
			zuotian(){
				this.zhanshi = 1
				var date = new Date()
				var oneDay = 24 * 3600 *1000
				date = new Date(date-oneDay)
				var year = date.getFullYear()
				var month = date.getMonth() + 1
				var day = date.getDate()
				this.datetimerange = [year+'-'+month+'-'+day,year+'-'+month+'-'+day]
				this.performance()
			},
			qitian(){
				this.zhanshi = 2
				var date = new Date()
				var oneDay = 24 * 3600 *1000 *7
				var date1 = new Date(date-oneDay)
				var year = date.getFullYear()
				var month = date.getMonth() + 1
				var day = date.getDate()
				var year1 = date1.getFullYear()
				var month1 = date1.getMonth() + 1
				var day1 = date1.getDate()
				this.datetimerange = [year1+'-'+month1+'-'+day1,year+'-'+month+'-'+day]
				this.performance()
			},
			performance(){
				var that = this
				uni.request({
				    url: that.global.url + 'api/partner/performance',
				    method: "POST",
					header: {
						'token': uni.getStorageSync('token')
					},
				    data: {
						begintime: this.datetimerange[0],
						endtime: this.datetimerange[1],
						uid: this.uid,
					},
				    success(res) {
				        let result = res.data
				        if(result.code == 1){
							that.list = result.data
						}else{
				           uni.showToast({
				           	title: result.msg,
				           	icon: 'error'
				           })
				        }
				       
				    }
				})
			},
		}
	}
</script>

<style>
	.content {}
	.uni-date-x--border {
		background-color: #fff;
	}
	.wid130{
		width: 130rpx;
	}
	.shebei{
		padding: 0 30rpx;
		height: 50rpx;
	}
</style>
